package com.lanyun.entity;

import cn.org.atool.fluent.mybatis.annotation.FluentMybatis;
import cn.org.atool.fluent.mybatis.annotation.LogicDelete;
import cn.org.atool.fluent.mybatis.annotation.TableField;
import cn.org.atool.fluent.mybatis.annotation.TableId;
import cn.org.atool.fluent.mybatis.base.IEntity;
import cn.org.atool.fluent.mybatis.base.RichEntity;
import cn.org.atool.fluent.mybatis.functions.TableSupplier;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.function.Consumer;

/**
 * ScenicEntity: 数据映射实体定义
 *
 * @author Powered By Fluent Mybatis
 */
@SuppressWarnings({"unchecked"})
@Data
@Accessors(
    chain = true
)
@EqualsAndHashCode(
    callSuper = false
)
@FluentMybatis(
    table = "scenic",
    schema = "tourist"
)
public class ScenicEntity extends RichEntity implements Serializable{
  private static final long serialVersionUID = 1L;

  /**
   */
  @TableId("id")
  private Long id;

  /**
   */
  @TableField(
      value = "create_time",
      insert = "now()"
  )
  private Date createTime;

  /**
   */
  @TableField(
      value = "update_time",
      insert = "now()",
      update = "now()"
  )
  private Date updateTime;

  /**
   */
  @TableField(
      value = "is_deleted",
      insert = "0"
  )
  @LogicDelete
  private Boolean isDeleted;

  /**
   */
  @TableField("image_id")
  private Integer imageId;

  /**
   */
  @TableField("landl")
  private String landl;

  /**
   */
  @TableField("name")
  private String name;

  /**
   */
  @TableField("num")
  private Integer num;

  /**
   */
  @TableField("place")
  private String place;

  /**
   */
  @TableField("price")
  private Integer price;

  /**
   */
  @TableField("routes_status")
  private Integer routesStatus;

  /**
   */
  @TableField("scenic_description")
  private String scenicDescription;

  /**
   */
  @TableField("scenic_type")
  private String scenicType;

  /**
   */
  @TableField("scenic_url")
  private String scenicUrl;

  /**
   */
  @TableField("text")
  private String text;

  @Override
  public Serializable findPk() {
    return this.id;
  }

  @Override
  public Consumer<Long> pkSetter() {
    return this::setId;
  }

  @Override
  public final Class<? extends IEntity> entityClass() {
    return ScenicEntity.class;
  }

  @Override
  public final ScenicEntity changeTableBelongTo(TableSupplier supplier) {
    return super.changeTableBelongTo(supplier);
  }

  @Override
  public final ScenicEntity changeTableBelongTo(String table) {
    return super.changeTableBelongTo(table);
  }
}
